import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 19182
 * Date: 2025-08-25
 * Time: 14:41
 */
public class demo1 {
    public static void main(String[] args) throws IOException {
        try(InputStream inputStream = new FileInputStream("./test.txt")){
            //读文件操作
            while(true){
                byte[] data = new byte[1024];
                //这里进行读文件操作
                //read方法会尽量把data数组填满, 填不满的话, 能填几个是几个
                //此处的n就表示读取了几个字节
                int n = inputStream.read(data);
                if(n == -1){
                    break; //文件读取完
                }
                for(int i = 0; i < n; i++){
                    System.out.printf("%d\n", data[i]);
                }
            }
        }
    }
}
